package srcInterviewPrep;

public class Interval implements Comparable<Interval>
{
    @Override
    public String toString() {
        return "Id=" + Id;
    }

    int StartTime;
    int FinishTime;
    int Id;
    
    public Interval(
            int Id,
            int StartTime,
            int FinishTime)
    {
        this.Id = Id;
        this.StartTime = StartTime;
        this.FinishTime = FinishTime;
    }
    
    @Override
    public int compareTo(Interval i2) 
    {
        if (this.FinishTime == i2.FinishTime)
        {
            return 0;
        }
        
        if (this.FinishTime < i2.FinishTime)
        {
            return -1;
        }
        
        return +1;
    }
}
